Repository navigation
Add support for SLH-DSA - #512
padelsbach wants to merge 1 commit into
Conversation
aed3238 to
7fe4069
Compare
64514ae to
a9eb8a9
Compare
a9eb8a9 to
43e9f7f
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #512
Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-src
Findings: 11
11 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #512
Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-src
Findings: 7
7 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Frauschi
left a comment
There was a problem hiding this comment.
Went through the SLH-DSA callback support. Big addition, and the structure mirrors the ML-DSA paths closely enough to follow easily.
Comments inline. The ones I would most like to see addressed are the DMA READ_POST after a denied READ_PRE in _HandleSlhDsaVerifyDma, the unvalidated seedSz / 3 in both keygen handlers, and the seed left resident in the comm packet. The rest are smaller consistency points against the ML-DSA and ML-KEM siblings, and the last few are nits you can take or leave.
Nothing here is a blocker.
Frauschi
left a comment
There was a problem hiding this comment.
Two small follow-ups from the last round - neither is blocking, and the rest of what I raised looks good now.
aedd93b to
69839ec
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Cache-mode flag handling, DER error reporting, and DMA cleanup can currently produce false success or leave unintended cached keys.
Review effort: Balanced
Findings: 3
Open (3)
What changed in this PR
Adds end-to-end SLH-DSA support across wolfHSM, including key management, signing, verification, DMA, crypto callbacks, examples, and CI coverage.
Changes:
- Adds SLH-DSA wire protocols and client/server cryptographic operations.
- Supports cached, exported, seeded, non-DMA, DMA, and callback-only workflows.
- Extends configuration, tests, examples, and CI for SLH-DSA.
| File | Description |
|---|---|
wolfhsm/wh_settings.h |
Documents SLH-DSA buffer requirements. |
wolfhsm/wh_server_crypto.h |
Declares server cache helpers. |
wolfhsm/wh_message_crypto.h |
Defines SLH-DSA wire messages. |
wolfhsm/wh_crypto.h |
Declares DER serialization support. |
wolfhsm/wh_common.h |
Adds the SLH-DSA algorithm identifier. |
wolfhsm/wh_client_crypto.h |
Exposes client SLH-DSA APIs. |
test/wh_test_check_struct_padding.c |
Covers new message layouts. |
test/config/user_settings.h |
Enables SLH-DSA in tests. |
test-refactor/wh_test_list.c |
Registers SLH-DSA tests. |
test-refactor/posix/Makefile |
Adds verify-only configuration. |
test-refactor/misc/wh_test_check_struct_padding.c |
Covers refactored message layouts. |
src/wh_server_keystore.c |
Supports public-key export. |
src/wh_server_crypto.c |
Implements server operations and DMA handlers. |
src/wh_message_crypto.c |
Implements message translation. |
src/wh_crypto.c |
Implements SLH-DSA DER conversion. |
src/wh_client_cryptocb.c |
Integrates wolfCrypt callbacks. |
src/wh_client_crypto.c |
Implements client and DMA APIs. |
examples/posix/wh_posix_server/user_settings.h |
Enables server-side SLH-DSA. |
examples/posix/wh_posix_client/user_settings.h |
Enables client and callback-only modes. |
examples/posix/wh_posix_client/Makefile |
Adds callback-only build selection. |
examples/demo/client/wh_demo_client_crypto.h |
Declares the SLH-DSA demo. |
examples/demo/client/wh_demo_client_crypto.c |
Implements the SLH-DSA demo. |
examples/demo/client/wh_demo_client_all.c |
Runs the SLH-DSA demo. |
.github/workflows/build-and-test-refactor.yml |
Tests verify-only builds. |
.github/workflows/build-and-run-examples.yml |
Tests callback-only operation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@padelsbach can you check the copilot comments and address if necessary, otherwise resolve and reassign me plz |
bbc5a63 to
aa14855
Compare
fe43259 to
9efa82f
Compare
d408125 to
7531b59
Compare
bigbrett
left a comment
There was a problem hiding this comment.
Some nits and a concern about the silent fallback. Also need to update PQC algo list in docs to include SLH-DSA. Also needs rebase and conflicts resolved. Perhaps squash the commits as well since you are rebasing anyway.
| if: matrix.group == 'pq-dma' | ||
| run: cd test-refactor/posix && make clean && make -j DMA=1 ASAN=1 MLDSA_VERIFY_ONLY=1 WOLFSSL_DIR=../../wolfssl && make run | ||
|
|
||
| # Verify-only drops the signing APIs, so this catches code that assumes them. |
There was a problem hiding this comment.
| # Verify-only drops the signing APIs, so this catches code that assumes them. |
| word32 sigLen = sizeof(signature); | ||
| byte addRnd[WC_SLHDSA_MAX_SEED]; | ||
|
|
||
| memset(addRnd, 0x42, sizeof(addRnd)); |
There was a problem hiding this comment.
The answer to the ultimate question. But perhaps also a comment saying "placeholder for user-supplied random input"
| endif | ||
|
|
||
| ifeq ($(SLHDSA_CB_ONLY),1) | ||
| DEF += -DWH_CFG_SLHDSA_CB_ONLY |
There was a problem hiding this comment.
where did WH_CFG_xxx come from? Our wolfHSM config macros are spelled WOLFHSM_CFG_XXXX
There was a problem hiding this comment.
Ha, good catch. Fixed
| do { | ||
| ret = wh_Client_RecvResponse(ctx, &group, &action, &res_len, | ||
| WOLFHSM_CFG_COMM_DATA_LEN, | ||
| (uint8_t*)dataPtr); | ||
| } while (ret == WH_ERROR_NOTREADY); |
There was a problem hiding this comment.
OK for a first stab, but we will eventually need async split transaction Request/response functions for all of these in the client API. Then the blocking one can just send the request and block on the response. wolfCrypt cryptocallback will then just use the blocking API. See how all the other crypto algorithms are implemetned in client API.
Def need a follow up PR with this. Fine for now.
There was a problem hiding this comment.
Async split is a big change. Punting on that for now
| if ((ret == WH_ERROR_REQUEST_SIZE) && _PqcSigCanVerifyLocally(type, key)) { | ||
| ret = CRYPTOCB_UNAVAILABLE; | ||
| } | ||
|
|
There was a problem hiding this comment.
I don't like this. Seems yet another place where we can silently fall back to local crypto on the client side. IMO this is a bad pattern. We dont want any surprises. IMO if the user explicitly requests something to go the HSM it should fail when it doesn't. There are already some edge cases in teh current code and I don't want to add more. Any reason you did it this way?
There was a problem hiding this comment.
I did this on the other PR too, trying to get too fancy. Removed.
c863daf to
352ff0e
Compare
352ff0e to
db1f170
Compare


No description provided.